package com.itheima.mapper;

import com.itheima.pojo.OrderSetting;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.time.LocalDate;
import java.util.List;

@Mapper
public interface OrderSettingMapper {

    @Update("update t_ordersetting set number = #{number} where orderDate = #{orderDate}")
    void editNumberByOrderDate(Integer number, LocalDate orderDate);

    @Select("select * from t_ordersetting where orderDate between #{begin} and #{end}")
    List<OrderSetting> getOrderSettingByMonth(LocalDate begin, LocalDate end);

    @Insert("insert into t_ordersetting (orderDate, number, reservations) values(#{orderDate},#{number},#{reservations})")
    void insert(OrderSetting orderSetting);

    @Select("select * from t_ordersetting where orderDate = #{date}")
    OrderSetting getOrderSettingByDate(LocalDate date);
}
